package _21define;

import java.io.File;
import java.util.Arrays;

public class ListFile {
    public static void main(String[] args) {
        File dir = new File("E:\\deleteexercise");
        File[] files=dir.listFiles((pathname -> pathname.getName().endsWith(".txt")));
        File[] files1=dir.listFiles((pathname -> pathname.getName().substring(0,1).endsWith("a")));
        File[] files2=dir.listFiles((pathname -> {
            String A=pathname.getName();
            for (int i = 0; i < A.length()-1; i++) {
                String B=A.substring(i,i+1);
                if (B.equals("a")){
                    return true;
                }
            }
            return false;
        }));
        System.out.println(Arrays.toString(files));
        System.out.println(Arrays.toString(files1));
        System.out.println(Arrays.toString(files2));

    }
}
